package org.gos.mission.service;

import java.sql.Connection;

import org.gos.mission.dao.LoginDaoMySQLImpl;
import org.gos.mission.domain.User;
import org.gos.mission.util.DB;


public class LoginServiceImpl implements LoginService{

	private LoginDaoMySQLImpl loginDao;

	private static LoginServiceImpl lsi ;

	public static LoginService getLoginService() {
		if(lsi == null){
			
			lsi = new LoginServiceImpl();
			
		}
		return lsi;
	}

	
	
	public LoginServiceImpl() {
		loginDao = new LoginDaoMySQLImpl();
	}



	public User login(String username, String password) {
		Connection conn = null;
		try {
			conn = DB.getConnection(ServiceManager.DB_CONNECTION);
			return loginDao.login(conn, username, password);
		} finally {
			DB.close(conn);
		}
	}
	

	
}
